package hhm.framessm.authority.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.druid.support.json.JSONParser;
import com.alibaba.fastjson.JSON;

import hhm.framessm.authority.service.RoleService;
import hhm.framessm.common.pojo.FBResult;
import hhm.framessm.pojo.TbRole;

@Controller
@RequestMapping("/role")
public class RoleController {
	@Autowired
	private RoleService roleService;

	@RequestMapping(value = "/get", method = RequestMethod.GET)
	@ResponseBody
	public FBResult get() {
		List<TbRole> list = roleService.fineAllRole();
		Map<String, Object> map = new HashMap<>();
		map.put("rows", list);
		map.put("total ", list.size());

		return FBResult.build(200, "success", JSON.toJSON(map));
	}
}
